<template>
	<view>
		<j-cell-group>
			<j-cell title="基本设置"
				:to="'/jvss/pagesDevice/device/device-live/setting/basic?deviceNo=' + device.deviceNo + '&deviceName=' + device.deviceName+ '&token=' + device.token+'&isSupportPTZDevice=' + device.isSupportPTZDevice + '&ability='+ `${JSON.stringify(ability)}`+'&pid='+device.pid">
			</j-cell>
			<!-- <j-cell title="基本设置"  @jftap="goSetting"></j-cell> -->
			<j-cell title="密码管理"
				:to="'/jvss/pagesDevice/device/device-live/setting/password?deviceNo=' + device.deviceNo + '&devUserName=' + device.devUserName + '&token=' + device.token+ '&devPassWord=' + device.devPassWord">
			</j-cell>
		</j-cell-group>

		<j-cell-group>
			<j-cell title="存储管理" :to="'/jvss/pagesDevice/device/device-live/setting/diskmemoro?token=' + device.token">
			</j-cell>
			<j-cell v-if="cellShow"  title="录像设置"
				:to="'/jvss/pagesDevice/device/device-live/setting/videoSetting?token=' + device.token"></j-cell>
		</j-cell-group>

		<j-cell-group>
			<!-- 智能摄像机 -->
			<j-cell v-if="cellShow" title="智能报警" data-code="604002" data-eventName="click_device_setting_alarm"
				:to="'/jvss/pagesDevice/device/device-live/setting/IPolice/callThePolice?token=' + device.token + '&deviceName=' + device.deviceName + '&deviceNo=' + device.deviceNo + '&ability='+ `${JSON.stringify(ability)}`">
			</j-cell>
			<j-cell v-if="cellShow" title="高级设置" @click="clickAdvancedSetting"
				:to="'/jvss/pagesDevice/device/device-live/setting/advanced?token=' + device.token + '&deviceName=' + device.deviceName + '&deviceNo=' + device.deviceNo + '&ability='+ `${JSON.stringify(ability)}`+'&pid='+device.pid">
			</j-cell>
			<j-cell title="关于设备"
				:to="'/jvss/pagesDevice/device/device-live/setting/about?token=' + device.token + '&deviceName=' + device.deviceName + '&deviceNo=' + device.deviceNo+'&isSupportPTZDevice=' + device.isSupportPTZDevice + '&ability='+ `${JSON.stringify(ability)}`+'&pid='+device.pid">
			</j-cell>
		</j-cell-group>

		<!-- <j-cell-group>
		    <j-cell title="一键遮蔽" :to="'/jvss/pagesDevice/device/device-live/setting/oneKeyMaskVideo?token=' + device.token"></j-cell>
		</j-cell-group> -->
		<!-- <j-cell title="设备配置" :to="'/jvss/pagesDevice/device/device-live/setting/configs/configs?token=' + device.token"></j-cell> -->

		<!-- <j-cell-group>
            <j-cell title="设备配置" :to="'/jvss/pagesDevice/device/device-live/setting/configs/configs?token=' + device.token"></j-cell>
        </j-cell-group>

        <j-cell-group>
            <j-cell title="基本设置" :to="'/jvss/pagesDevice/device/device-live/setting/basic/basic?deviceNo=' + device.deviceNo + '&deviceName=' + device.deviceName"></j-cell>
            <j-cell
                title="密码管理"
                :to="'/jvss/pagesDevice/device/device-live/setting/password/password?deviceNo=' + device.deviceNo + '&devUserName=' + device.devUserName + '&token=' + device.token"
            ></j-cell>
        </j-cell-group>

        <j-cell-group>
            <j-cell title="存储管理" :to="'/jvss/pagesDevice/device/device-live/setting/IE/StorageInfo/StorageInfo?token=' + device.token"></j-cell>
        </j-cell-group>

        <j-cell-group title="媒体组件配置">
            <j-cell title="编码配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/AVEnc-Encode/AVEnc-Encode?token=' + device.token"></j-cell>
            <j-cell title="视频配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/AVEnc-VideoWidget/AVEnc-VideoWidget?token=' + device.token"></j-cell>
            <j-cell title="TV调节配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/fVideo-Volume/fVideo-Volume?token=' + device.token"></j-cell>
            <j-cell title="视频输入颜色配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/AVEnc-VideoColor/AVEnc-VideoColor?token=' + device.token"></j-cell>
            <j-cell title="录像配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Record/Record?token=' + device.token"></j-cell>
            <j-cell title="抓图配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Storage-Snapshot/Storage-Snapshot?token=' + device.token"></j-cell>
            <j-cell title="视频遮挡配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Detect-BlindDetect/Detect-BlindDetect?token=' + device.token"></j-cell>
            <j-cell title="动态检测配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Detect-MotionDetect/Detect-MotionDetect?token=' + device.token"></j-cell>
            <j-cell title="视频丢失配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Detect-LossDetect/Detect-LossDetect?token=' + device.token"></j-cell>
            <j-cell title="报警服务" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-AlarmServer/NetWork-AlarmServer?token=' + device.token"></j-cell>
            <j-cell title="通道标题" :to="'/jvss/pagesDevice/device/device-live/setting/IE/ChannelTitle/ChannelTitle?token=' + device.token"></j-cell>
            <j-cell title="屏幕提示信息" :to="'/jvss/pagesDevice/device/device-live/setting/IE/fVideo-OSDInfo/fVideo-OSDInfo?token=' + device.token"></j-cell>
            <j-cell title="H.264+" :to="'/jvss/pagesDevice/device/device-live/setting/IE/AVEnc-SmartH264/AVEnc-SmartH264?token=' + device.token"></j-cell>
        </j-cell-group>

        <j-cell-group title="串口组件配置">
            <j-cell title="串口配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Uart-Comm/Uart-Comm?token=' + device.token"></j-cell>
            <j-cell title="云台配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Uart-PTZ/Uart-PTZ?token=' + device.token"></j-cell>
            <j-cell title="云台预置点" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Uart-PTZPreset/Uart-PTZPreset?token=' + device.token"></j-cell>
            <j-cell title="云台巡航路径" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Uart-PTZTour/Uart-PTZTour?token=' + device.token"></j-cell>
            <j-cell title="透明串口" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Uart-RS485/Uart-RS485?token=' + device.token"></j-cell>
        </j-cell-group>

        <j-cell-group title="网络组件配置">
            <j-cell title="网络通用配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-NetCommon/NetWork-NetCommon?token=' + device.token"></j-cell>
            <j-cell title="网络接口配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-NetDHCP/NetWork-NetDHCP?token=' + device.token"></j-cell>
            <j-cell title="电子邮件配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-NetEmail/NetWork-NetEmail?token=' + device.token"></j-cell>
            <j-cell title="网络时间同步服务器配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-NetNTP/NetWork-NetNTP?token=' + device.token"></j-cell>
            <j-cell title="DNS" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-NetDNS/NetWork-NetDNS?token=' + device.token"></j-cell>
            <j-cell title="FTP" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-NetFTP/NetWork-NetFTP?token=' + device.token"></j-cell>
            <j-cell title="IP冲突配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Alarm-NetIPConflict/Alarm-NetIPConflict?token=' + device.token"></j-cell>
            <j-cell title="网络断开配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Alarm-NetAbort/Alarm-NetAbort?token=' + device.token"></j-cell>
            <j-cell title="UPNP" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-Upnp/NetWork-Upnp?token=' + device.token"></j-cell>
            <j-cell title="IP过滤" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-NetIPFilter/NetWork-NetIPFilter?token=' + device.token"></j-cell>
            <j-cell title="DAS" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-DAS/NetWork-DAS?token=' + device.token"></j-cell>
            <j-cell title="PMS" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-PMS/NetWork-PMS?token=' + device.token"></j-cell>
            <j-cell title="雄迈云" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-Nat/NetWork-Nat?token=' + device.token"></j-cell>
            <j-cell title="Wifi配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/NetWork-Wifi/NetWork-Wifi?token=' + device.token"></j-cell>
        </j-cell-group>

        <j-cell-group title="GUI组件配置">
            <j-cell title="GUI界面配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/fVideo-GUISet/fVideo-GUISet?token=' + device.token"></j-cell>
        </j-cell-group>

        <j-cell-group title="存储组件配置">
            <j-cell title="存储位置配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Storage-StoragePosition/Storage-StoragePosition?token=' + device.token"></j-cell>
            <j-cell title="无存储设备配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Storage-StorageNotExist/Storage-StorageNotExist?token=' + device.token"></j-cell>
            <j-cell title="存储容量低配置" :to="'/jvss/pagesDevice/device/device-live/setting/SIE/torage-StorageLowSpace/Storage-StorageLowSpace?token=' + device.token"></j-cell>
            <j-cell title="存储设备访问失败时配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Storage-StorageFailure/Storage-StorageFailure?token=' + device.token"></j-cell>
        </j-cell-group>

        <j-cell-group title="Manager组件配置">
            <j-cell title="普通配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/General-General/General-General?token=' + device.token"></j-cell>
            <j-cell title="本地化配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/General-Location/General-Location?token=' + device.token"></j-cell>
            <j-cell title="自动维护配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/General-AutoMaintain/General-AutoMaintain?token=' + device.token"></j-cell>
        </j-cell-group>

        <j-cell-group title="简化组件配置">
            <j-cell title="编码参数配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Simplify-Encode/Simplify-Encode?token=' + device.token"></j-cell>
        </j-cell-group>

        <j-cell-group title="摄像机参数配置">
            <j-cell title="基本参数配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Camera-Param/Camera-Param?token=' + device.token"></j-cell>
            <j-cell title="扩展功能参数配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Camera-ParamEx/Camera-ParamEx?token=' + device.token"></j-cell>
            <j-cell title="去雾功能参数配置" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Camera-ClearFog/Camera-ClearFog?token=' + device.token"></j-cell>
            <j-cell title="白光灯控制" :to="'/jvss/pagesDevice/device/device-live/setting/IE/Camera-WhiteLight/Camera-WhiteLight?token=' + device.token"></j-cell>
        </j-cell-group>

        <j-cell-group>
            <j-cell title="关于设备" :to="'/jvss/pagesDevice/device/device-live/setting/IE/SystemInfo/SystemInfo?token=' + device.token"></j-cell>
        </j-cell-group> -->
	</view>
</template>

<script>
	const constant = getApp().globalData.constant;
	export default {
		data() {
			return {
				device: {
					token: '',
					deviceNo: '',
					deviceName: '',
					devUserName: '',
				},
				ability: '',
				abilityjson: '',
				cellShow:false
			};
		}
		/**
		 * 生命周期函数--监听页面加载
		 */
		,
		onLoad: function(options) {
			// console.log('=== device-live:setting:onLoad:', JSON.parse(options.device));
			// this.device = JSON.parse(options.device)
			let enData = decodeURIComponent(options.device)
			this.device = JSON.parse(enData)
			let pid = this.device.pid
			if(pid === constant.DEVICE_TYPE.EE_DEV_BOUTIQUEROBOT || pid === constant.DEVICE_TYPE.EE_DEV_NORMAL_MONITOR){
				console.log(pid,'有')
				this.cellShow = true
			}
			this.b()
			console.log('tokenName测试=====', this.device.token, this.device.deviceName);
		},
		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady: function() {
			console.log('=== device-live:setting:onReady:');
		},
		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow: function() {
			console.log('=== device-live:setting:onShow:');
			// this.a()
			// this.b()
			// this.c()
			// this.d()
		},
		/**
		 * 生命周期函数--监听页面隐藏
		 */
		onHide: function() {
			console.log('--- device-live:setting:onHide:');
		},
		/**
		 * 生命周期函数--监听页面卸载
		 */
		onUnload: function() {
			console.log('--- device-live:setting:onUnload:');
		},
		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh: function() {},
		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom: function() {},
		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage: function() {},
		methods: {
			clickAdvancedSetting(){
				// isOpen对应的是啥？
				this.$postPointData({code:'604008',eventName:'click_device_setting_alarm_ex',isOpen:false})
			},
			goSetting() {
				uni.navigateTo({
					url: '/jvss/pagesDevice/device/device-live/setting/basic?deviceNo=' + this.device.deviceNo +
						'&deviceName=' + this.device.deviceName + '&token=' + this.device.token
				})
			},
			a() {
				uni.showLoading();
				let token = this.device.token;
				let data = {
					Name: 'AlarmInfo'
				};
				getApp().globalData.api.getconfig(data, token, (result) => {
					uni.hideLoading({
						success: (res) => {
							console.log('====================获取配置：', result);
						}
					});
				});
			},

			b() {
				uni.showLoading();
				let token = this.device.token;
				let data = {
					Name: 'SystemFunction'
				};
				getApp().globalData.api.getability(data, token, (result) => {
					uni.hideLoading({
						success: (res) => {
							console.log('====================获取能力集：', result.SystemFunction);
							this.ability = result.SystemFunction
							this.abilityjson = JSON.stringify(result.SystemFunction)
						}
					});
				});
			},

			c() {
				uni.showLoading();
				let token = this.device.token;
				let data = {
					// Name: 'AlarmInfo'
					Name: 'SystemInfo'
				};
				uni.request({
					url: 'https://rds.bcloud365.net/v2/rtc/device/getinfo/' + token,
					method: 'POST',
					data,
					header: {
						'content-type': 'application/json;charset:utf-8'
					},
					success: (res) => {
						console.log(res, '获取状态');
					}
				})
				// getApp().globalData.api.getinfo(data, token, (result) => {
				//     uni.hideLoading({
				//         success: (res) => {
				//             console.log('====================获取信息：', result);
				//         }
				//     });
				// });
			},

			d() {
				uni.showLoading();
				let token = this.device.token;
				let data = {
					Name: 'OPLogQuery',
					Operation: {
						Command: '',
						Parameter: []
					}
				};
				getApp().globalData.api.opdev(data, token, (result) => {
					uni.hideLoading({
						success: (res) => {
							console.log('====================设备操作：', result);
						}
					});
				});
			}
		}
	};
</script>
<style></style>
